<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>交换两个变量</title>
</head>
<body>
    <script>
        let apple = "苹果";
        let banana = "香蕉";
        // 交换变量
        let temp  // 当一个空杯子（临时变量）
        temp = apple;// 把苹果给杯子
        apple = banana;// 把香蕉给苹果
        banana = temp;//临时变量给banana
        console.log(apple);
        console.log(banana);
    </script>
</body>
</html>